;
(function() {
	var BusCon = require("../../core/bus/_con");
	var db = require("../../core/db/index");
	var config = require("../../core/_include/config");
	var ResponObj = require("../_include/responObj");
	var BuffCon = require("../../core/buff/_con");
	var myfs = require("../_include/fs");
	var theme = require("./theme");
	var role = require("./role");
	module.exports = {
		prefix: "/user/bus_bind",
		get: {
			"/": function() {
				var user = role.getUser(this);
				var query = this.request.query;
				var result = user.getAccBus(query.num, query.page);
				this.body = ResponObj("json", result);
			},
			"/by_bus_id": function() {
				var user = role.getUser(this);
				var query = this.request.query;
				var bus_id = query.bus_id;
				if (!bus_id) {
					throwCusError("参数错误")
				}
				var result = user.getAccBusById(query.bus_id);
				this.body = ResponObj("json", result);
			}
		},
		put: {
			"/state/weishenqingduihuan_to_shenqingduihuanzhong": function() {
				var user = role.getUser(this);
				var bus_id = this.request.body.bus_id;
				if (!bus_id) {
					throwCusError("参数错误")
				}
				var bus_user_bind = user.state_weishenqingduihuan_to_shenqingduihuanzhong(bus_id);
				this.body = ResponObj("json", bus_user_bind);
			},
			"/state/shangjiayijingfukuan_to_yonghuquerenfukuan": function() {
				var user = role.getUser(this);
				var bus_id = this.request.body.bus_id;
				if (!bus_id) {
					throwCusError("参数错误")
				}
				var bus_user_bind = user.state_shangjiayijingfukuan_to_yonghuquerenfukuan(bus_id);
				this.body = ResponObj("json", bus_user_bind);
			},
			"/to_bususer_money": function() {
				var user = role.getUser(this);
				var bus_id = this.request.body.bus_id;
				var money = this.request.body.money;
				if (!(bus_id && money)) {
					throwCusError("参数错误")
				}
				var bus_user_bind = user.acc_to_BusUser_money(bus_id, money);
				this.body = ResponObj("json", bus_user_bind);
			}
		}
	}
}());